import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/login';
import Layout from '../views/layout'


Vue.use(VueRouter)

const routes = [
  {path:'/' ,redirect:{path:'/login'}},
  {path:'/login',component:Login},
  {
    path: '/',component: Layout, children: [
      { path: "home", component: () => import('../views/home') }
    ]},
  {
    path: '/users', meta: { path: '/users' }, component: Layout, redirect: '/users', children: [
      { path: 'users',meta: { path: '/users' }, component: () => import('../views/users/userslist.vue') }]
  },
  {
    path: '/rights', component: Layout, redirect: '/rights/rights', children: [
    {path:'rights',component:()=>import('../views/power/powerList.vue')},
    {path:'roles',component:()=>import('../views/power/rolesList.vue')},
  ]},
  {path: '/goods', meta: {path:'/goods'},  component: Layout, children: [
      { path: 'goods', meta: {path:'/goods'}, component: () => import('../views/goods/goodsList.vue') },
      { path: 'params',  meta: {path:'/goods/params'}, component: () => import('../views/goods/categories.vue') },
      { path: 'categories',  meta: {path:'/goods/categories'}, component: () => import('../views/goods/goodsParams.vue') },
      { path: 'save',  meta: {path:'/goods/save'}, component: () => import('../views/goods/goodsSave') },
     
    ]
  },
    // 订单
    {path: "/orders", meta: { path: '/orders'}, component: Layout, redirect: "/orders", children: [
        { path: "orders", meta: { path: '/orders' }, component: () => import("../views/orders/ordersList.vue") }
      ]
    },
    // 数据统计
    {path: "/reports", meta: { path: '/reports'}, component: Layout, redirect: "/reports", children: [
        { path: "reports", meta: { path: '/reports' }, component: () => import("../views/reports/reportsList.vue") }
      ]
    },

]

const router = new VueRouter({
  routes
})

export default router
